//index.js
//获取应用实例
const app = getApp()

Page({
  data: {
    ratio: 102/152,
    type:0,
    isColours:true,
    id:1,
    originUrl: '',
    cropperResult: '',
    isShow:true,
    isblock:true,
     // 组件所需的参数
     nvabarData: {
      showCapsule: 1, //是否显示左上角图标   1表示显示    0表示不显示
      title: '6寸照片', //导航栏 中间的标题
    },
    // 此页面 页面内容距最顶部的距离
    height: app.globalData.height * 2 + 20,
  },
  uploadTap() {
    let that = this
    wx.chooseImage({
      count: 1, // 默认9
      sizeType: ['original'], // 可以指定是原图还是压缩图，默认二者都有
      sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机，默认二者都有
      success(res) {
        that.setData({
          originUrl: res.tempFilePaths[0],
          cropperResult: '',
          isShow:false
        })
      }
    })
  },
  getCropperImg(e) {
    console.log(e)
    this.setData({
      originUrl: '',
      cropperResult: e.detail.url,
      isShow:true,
      isblock:false
    })
  },
  // 提交
  submitAdvice: function () {
    let that = this;
    if (that.data.cropperResult == '') {
      wx.showToast({
        title: '请先选择照片',
        icon: 'none',
        duration: 2000
      })
    }else{
      wx.showLoading({
        title: '提交中。。。',
      })
      let pics = this.data.pics
        wx.hideLoading();
        wx.navigateTo({
          url: '/modelA/pages/drawings_printing/picplace_order/picplace_order?pics='+that.data.cropperResult+'&title='+'6寸照片'+'&type='+that.data.type+'&ccinfo='+'10.2*15.2cm'+'&isColours='+that.data.isColours+'&id='+that.data.id,
          success: function(res) {},
          fail: function(res) {},
          complete: function(res) {},
        })
    }
   
  }
})
